package com.itlong.cloud.service.impl;

import com.itlong.cloud.POJO.PO.UserLoginLogPO;
import com.itlong.cloud.PlatformConstants;
import com.itlong.cloud.dao.IUserLoginLogDao;
import com.itlong.cloud.service.IUserLoginLogService;
import com.itlong.cloud.utils.data.handler.SqlUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * <desc>
 *      登录日志业务处理接口实现类
 * </desc>
 *
 * @createDate 2018/05/02
 */
@Service
public class UserLoginLogServiceImpl implements IUserLoginLogService {

    @Autowired
    private IUserLoginLogDao iUserLoginLogDao;

    /**
     * <desc>
     *      保存日志
     * </desc>
     *
     * @param userLoginLogPO 登陆日志实体类
     * @return sql执行行数
     * @author wangzhi
     * @createDate 2018/05/02
     */
    @Override
    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
    public Integer save(UserLoginLogPO userLoginLogPO) throws Exception {
        return iUserLoginLogDao.save(SqlUtil.durableData(userLoginLogPO, PlatformConstants.TABLE_SAVE));
    }
}
